import { DataSet } from 'choerodon-ui/pro';

const executionStatusData = [
  {
    name: '待审核',
    value: 'manual',
  },
  {
    name: '成功',
    value: 'success',
  },
  {
    name: '失败',
    value: 'failed',
  },
  {
    name: '准备中',
    value: 'pending',
  },
  {
    name: '执行中',
    value: 'running',
  },
  {
    name: '已取消',
    value: 'canceled',
  },
  {
    name: '已跳过',
    value: 'skipped',
  },
];

const enableDisableStatusData = [
  {
    name: '启用',
    value: 'true',
  },
  {
    name: '停用',
    value: 'false',
  },
];

export default () => ({
  autoCreate: true,
  fields: [
    {
      name: 'searchParam',
    },
    {
      name: 'status',
      label: '最近执行状态',
      valueField: 'value',
      textField: 'name',
      options: new DataSet({
        data: executionStatusData,
      }),
    },
    {
      name: 'enableFlag',
      label: '启停用状态',
      valueField: 'value',
      textField: 'name',
      options: new DataSet({
        data: enableDisableStatusData,
      }),
    },
  ],
});
